package com.example.qxfw.nyqx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.qx.MgfxYzDisppara;
import com.example.qxfw.nyqx.mapper.MgfxYzDispparaMapper;
import com.example.qxfw.nyqx.service.MgfxYzDispparaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class  MgfxYzDispparaServiceImpl implements MgfxYzDispparaService {

    @Autowired
    private MgfxYzDispparaMapper mgfxYzDispparaMapper;

    @Override
    public List<MgfxYzDisppara> getList(String factorIndex) {
        return mgfxYzDispparaMapper.selectList(Wrappers.<MgfxYzDisppara>lambdaQuery().eq(MgfxYzDisppara::getFactorindex,factorIndex).orderByAsc(MgfxYzDisppara::getValue));
    }

    @Override
    public Integer update(MgfxYzDisppara mgfxYzDisppara) {
        return mgfxYzDispparaMapper.update(mgfxYzDisppara, Wrappers.<MgfxYzDisppara>lambdaUpdate().eq(MgfxYzDisppara::getLevel,mgfxYzDisppara.getLevel()).eq(MgfxYzDisppara::getFactorindex,mgfxYzDisppara.getFactorindex()));
    }

    @Override
    public Integer save(MgfxYzDisppara mgfxYzDisppara) {
        return mgfxYzDispparaMapper.insert(mgfxYzDisppara);
    }

    @Override
    public Integer delete(String id) {
        return mgfxYzDispparaMapper.delete(Wrappers.<MgfxYzDisppara>lambdaQuery().eq(MgfxYzDisppara::getId,id));
    }
}
